{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 这个文件是用来展示如何使用everytools库在代码中快速搜索磁盘里面的文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d:\\anaconda3\\envs\\office_automation\\Lib\\site-packages\\everytools\\dll\\Everything64.dll\n"
     ]
    }
   ],
   "source": [
    "from everytools import EveryTools       # 导入everytools模块\n",
    "es = EveryTools()                       # 实例化EveryTools类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "es.search_pic('X367')            # 搜索图片,参数为搜索关键字\n",
    "print(es.get_num_total_file())  # 获取搜索结果总数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 在指定的文件夹中搜索文件特定文件\n",
    "这个方法可以搜索共享文件中的文件，这个路径可以在资源管理器上方的地址栏复制\n",
    "**注意** 路径前面需要加上r，防止`\\`被转义"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "es.search_in_located(r'Z:\\05-印花PNG', 'A549')      # 搜索指定目录下的文件\n",
    "print(es.get_num_total_file())                      # 获取搜索结果总数"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "office_automation",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
